package com.sinosoft.demo2;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;

/**
 * @Author: WangShengJie
 * @Date: 2024/9/6
 */
public class JSONDemo {
    public static void main(String[] args) {
        /**
         *
         */
        String str = "{\n" +
                "    \"stateCode\": 0,\n" +
                "    \"message\":\"服务调用成功\",\n" +
                "    \"data\": {\n" +
                "        \"rows\":[{\n" +
                "              \"customer_type\":\"\",\n" +
                "              \"customer_class\":\"\",\n" +
                "              \"name\":\"\",\n" +
                "              \"wechat_nick\":\"\",\n" +
                "              \"sex\":\"\",\n" +
                "              \"id_type\":\"\",\n" +
                "              \"id_no\":\"\",\n" +
                "              \"validity_date\":\"\",\n" +
                "              \"birthday\":\"\",\n" +
                "              \"age\":\"\",\n" +
                "              \"height\":\"\",\n" +
                "              \"weight\":\"\",\n" +
                "              \"work_unit_school_name\":\"\",\n" +
                "              \"mobile_phone\":\"\",\n" +
                "              \"marriage\":\"\",\n" +
                "              \"child_flag\":\"\",\n" +
                "              \"degree\":\"\",\n" +
                "              \"emergency_contact\":\"\",\n" +
                "              \"email\":\"\",\n" +
                "              \"country_or_area\":\"\",\n" +
                "              \"mail_province_addr\":\"\",\n" +
                "              \"mail_city_addr\":\"\",\n" +
                "              \"mail_detail_addr_cn\":\"\",\n" +
                "              \"mail_zip_code\":\"\",\n" +
                "              \"is_eq\":\"\",\n" +
                "              \"home_province_addr\":\"\",\n" +
                "              \"home_city_addr\":\"\",\n" +
                "              \"home_detail_addr_cn\":\"\",\n" +
                "              \"home_zip_code\":\"\",\n" +
                "              \"care_points\":\"\",\n" +
                "              \"end_care_points\":\"\",\n" +
                "              \"his_pay_sprem\":\"\",\n" +
                "              \"pers_cust_aip\":\"\",\n" +
                "              \"social_security\":\"\",\n" +
                "              \"commercial_insurance_status\":\"\",\n" +
                "              \"family_expense\":\"\",\n" +
                "              \"family_income\":\"\",\n" +
                "              \"loan_state\":\"\",\n" +
                "              \"transportation\":\"\",\n" +
                "              \"house_state\":\"\",\n" +
                "              \"investment_info\":\"\",\n" +
                "              \"health_flag\":\"\",\n" +
                "              \"existing_product_categories\":\"\",\n" +
                "              \"product_tendency\":\"\",\n" +
                "              \"bak_info\":\"\",\n" +
                "              \"past_uw_result\":\"\",\n" +
                "              \"card_type\":\"\",\n" +
                "              \"bank_id\":\"\",\n" +
                "              \"card_number\":\"\",\n" +
                "              \"occupation_name\":\"\",\n" +
                "              \"occupation_code\":\"\",\n" +
                "              \"occupation_type\":\"\",\n" +
                "              \"work_context\":\"\",\n" +
                "              \"part_time\":\"\",\n" +
                "              \"work_phone\":\"\",\n" +
                "              \"home_phone\":\"\",\n" +
                "              \"customer_merge_no\":\"\",\n" +
                "              \"customer_level\":\"\",\n" +
                "              \"year_salary\":\"\",\n" +
                "              \"open_id\":\"\",\n" +
                "              \"union_id\":\"\",\n" +
                "              \"image_url\":\"\",\n" +
                "              \"is_pers_cust_prop\":\"\",\n" +
                "              \"is_pers_cust_insured\":\"\",\n" +
                "              \"is_starred\":\"\",\n" +
                "              \"sever_year\":\"\",\n" +
                "              \"non_std_flag\":\"\"\n" +
                "             }],\n" +
                "        \"totalNum\": 1,\n" +
                "        \"pageSize\": 2,\n" +
                "        \"pageNum\": 3\n" +
                "    }\n" +
                "}";
        JSONObject jsonObject = JSON.parseObject(str);
        System.out.println(jsonObject + "===jsonObject");
        JSONObject data = jsonObject.getJSONObject("data");
        System.out.println("data==" + data);
        JSONArray array = data.getJSONArray("rows");
        System.err.println(array);
        String string = array.getString(0);
        System.out.println(string+"+++");
        String totalNum = data.getString("totalNum");
        String pageSize = data.getString("pageSize");
        String pageNum = data.getString("pageNum");
        System.out.println(totalNum);
        System.out.println(pageSize);
        System.out.println(pageNum);
    }
}
